﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.ComponentModel;

namespace Oroboros.Save_Data
{
    [XmlInclude(typeof(ChainsawItemSaveData)), XmlInclude(typeof(AmmoBoxItemSaveData)), XmlInclude(typeof(GunItemSaveData)), XmlInclude(typeof(MeleeItemSaveData))]
    public class ItemSaveData : INotifyPropertyChanged
    {
        private Guid _Guid;

        private int _FoodUnits = -1;
        private int _FuelUnits = -1;
        private int _MedicineUnits = -1;
        private string _ItemClassName = string.Empty;
        private ItemLocation _Location = new ItemLocation();

        public Guid Guid { get { return _Guid; } set { Changed("Guid"); _Guid = value; } }
        public int FoodUnits { get { return _FoodUnits; } set { Changed("FoodUnits"); _FoodUnits = value; } }
        public int FuelUnits { get { return _FuelUnits; } set { Changed("FuelUnits"); _FuelUnits = value; } }
        public int MedicineUnits { get { return _MedicineUnits; } set { Changed("MedicineUnits"); _MedicineUnits = value; } }
        public string ItemClassName { get { return _ItemClassName; } set { Changed("ItemClassName"); _ItemClassName = value; } }
        public ItemLocation Location { get { return _Location; } set { Changed("Location"); _Location = value; } }

        public event PropertyChangedEventHandler PropertyChanged;
        public void Changed(string n)
        {
            if (!string.IsNullOrEmpty(n))
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs(n));
        }

        public override string ToString()
        {
            return ItemClassName;
        }
    }
}
